layui.use(function(){
    var form = layui.form;
    var layer = layui.layer;
    var upload = layui.upload;
    var $ = layui.$;
    //显示安装按钮
    layer.msg('正在加载中', {icon: 16,time: 1});
    $('#install1').show();$('#install2').show();
    //在线安装
    $('#install1').on('click', function() {
        layer.alert('请选择下载线路', {
          btn: ['主线路', '备用线路', '取消'],
          btnAlign: 'c', // 按钮居中显示
          btn1: function(){
            layer.load(1, {shade:[0.3,'#fff']});
            layer.msg('正在下载安装包,请勿操作.', {icon: 16,time: 1000*300});
            $.post("",{"url":"http://n1.lm21.top/install/install.tar.gz"}, function(data, status) {
                layer.closeAll();
                if (data.code == 1) { 
                    layer.msg(data.msg, {icon: 16,time: 1000*300});
                    setTimeout(function(){
                        window.location.href = "./";
                    }, 3000);
                }else{
                    layer.alert(data.msg, {title: '安装结果'});
                }
            });
          },
          btn2: function(){
            layer.load(1, {shade:[0.3,'#fff']});
            layer.msg('正在下载安装包,请勿操作..', {icon: 16,time: 1000*300});
            $.post("",{"url":"https://gitee.com/tznb/TwoNav_Resource/raw/master/install.tar.gz"}, function(data, status) {
                layer.closeAll();
                if (data.code == 1) { 
                    layer.msg(data.msg, {icon: 16,time: 1000*300});
                    setTimeout(function(){
                        window.location.href = "./";
                    }, 3000);
                }else{
                    layer.alert(data.msg, {title: '安装结果'});
                }
            });
          }
        });
    });
});